import { IViewData } from "../Interface/IMessage";

export default class AppService {
    private static _instance: AppService = null;
    public static get instance() {
        if (this._instance === null) {
            this._instance = new this();
        }
        return this._instance;
    }

    /** 注册页面/弹窗 */
    private registViewDatas: Map<string, IViewData> = new Map();

    /**
     * 注册弹窗
     * @param viewData 
     * @param popViewClass 
     */
    public registViewData(viewData: IViewData) {
        const data = this.registViewDatas.get(viewData.name);
        if (!data) {
            this.registViewDatas.set(viewData.name, viewData);
        }
    }

    public getRegistView(name: string) {
        return this.registViewDatas.get(name);
    }
}